/*
 * Created: Author: Aléx Carvalho / Date: Mar 11, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-12 01:05:20 -0300 (Fri, 12 Jun 2015) $
 */
package com.cpm.view.zk.composers;

import com.cpm.view.zk.applications.HomeApplication;
import com.cpm.view.zk.pane.HeaderPane;
import org.zkoss.zk.ui.util.GenericComposer;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.North;

public class ApplicationComposer extends GenericComposer<Borderlayout> {

    @Override
    public void doAfterCompose(Borderlayout comp) throws Exception {

        HeaderPane headerPane = new HeaderPane();
        
        Center center = new Center();
        North north = new North();
        
        center.setBorder("none");
        north.setBorder("none");
        
        north.appendChild(headerPane.getElement());
        
        comp.appendChild(north);
        comp.appendChild(center);
        
        headerPane.setCallback(c -> {
            center.getChildren().clear();
            center.appendChild(c.getElement());
        });
    }
}
